package shouji;

/**
 * @author zihao
 * @date 2025/3/18 11:52
 * @VERSION
 * @description
 **/
public class Rectangle {
    private double length;
    private double width;
    //空参构造
    public Rectangle() {
    }
    //满参构造
    public Rectangle(double length, double width) {
        this.length = length;
        this.width = width;
    }
    //get
    public double getLength() {
        return length;
    }
    //set
    public void setLength(double length) {
        this.length = length;
    }
    //get
    public double getWidth() {
        return width;
    }
    //set
    public void setWidth(double width) {
        this.width = width;
    }

    //行为
    public double getArea(double length, double width){
        System.out.println("面积是"+length*width);
        return length*width;
    }
    public double getPerimeter(double length,double width){
        System.out.println("周长是");
        return 2*(length+width);
    }
    public void getInfo(){
        System.out.println("长："+length+" "+"宽："+width+" "+"面积："+(length*width+" "+"周长"+2*(length+width)));
    }
}
